home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / graphic / frasr182.zip / FRACTINT.H < prev    next >
C/C++ Source or Header  |  1993-08-23  |  20KB  |  668 lines

  1. /* FRACTINT.H - common structures and values for the FRACTINT routines */
  2.  
  3. #if defined(PUTTHEMHERE)        /* this MUST be defined ONLY in FRACTINT.C */
  4. struct videoinfo videoentry;
  5. int helpmode;
  6. #endif
  7.  
  8. #ifndef FRACTINT_H
  9. #define FRACTINT_H
  10.  
  11. #if !defined(PUTTHEMHERE)  
  12. extern struct videoinfo videoentry;
  13. extern int        helpmode;
  14. #endif
  15.  
  16. #include <math.h>
  17. #include "port.h"
  18.  
  19. typedef BYTE BOOLEAN;
  20.  
  21. #ifndef C6
  22. #define _fastcall    /* _fastcall is a Microsoft C6.00 extension */
  23. #endif
  24.  
  25. #ifndef XFRACT
  26. typedef int SEGTYPE;
  27. typedef unsigned USEGTYPE;
  28. #ifdef __TURBOC__
  29. #   define _bios_printer(a,b,c)   biosprint((a),(c),(b))
  30. #   define _bios_serialcom(a,b,c) bioscom((a),(c),(b))
  31. #else
  32. #ifndef __WATCOMC__
  33. #ifndef MK_FP
  34. #   define MK_FP(seg,off) (VOIDFARPTR )( (((long)(seg))<<16) | \
  35.                                           ((unsigned)(off)) )
  36. #endif
  37. #endif
  38. #endif
  39. #else
  40. typedef char * SEGTYPE;
  41. typedef char * USEGTYPE;
  42. #   define MK_FP(seg,off) (VOIDFARPTR )(seg+off)
  43. #endif
  44.  
  45.  
  46. #ifndef XFRACT
  47. #define clock_ticks() clock()
  48. #endif
  49.  
  50. #ifdef XFRACT
  51. #define _fstrcpy(to,from) strcpy(to,from)
  52. #endif
  53.  
  54. /* these are used to declare arrays for file names */
  55. #define FILE_MAX_PATH  80       /* max length of path+filename  */
  56. #define FILE_MAX_DIR   80       /* max length of directory name */
  57. #define FILE_MAX_DRIVE  3       /* max length of drive letter   */
  58. #define FILE_MAX_FNAME  9       /* max length of filename       */
  59. #define FILE_MAX_EXT    5       /* max length of extension      */
  60.  
  61. #define MAXPARAMS 10        /* maximum number of parameters */
  62. #define MAXPIXELS 2048        /* Maximum pixel count across/down the screen */
  63. #define DEFAULTASPECT 0.75    /* Assumed overall screen dimensions, y/x     */
  64.  
  65. struct videoinfo {        /* All we need to know about a Video Adapter */
  66.     char    name[26];    /* Adapter name (IBM EGA, etc)        */
  67.     char    comment[26];    /* Comments (UNTESTED, etc)        */
  68.     int    keynum;     /* key number used to invoked this mode */
  69.                 /* 2-10 = F2-10, 11-40 = S,C,A{F1-F10}    */
  70.     int    videomodeax;    /* begin with INT 10H, AX=(this)    */
  71.     int    videomodebx;    /*        ...and BX=(this)    */
  72.     int    videomodecx;    /*        ...and CX=(this)    */
  73.     int    videomodedx;    /*        ...and DX=(this)    */
  74.                 /* NOTE:  IF AX==BX==CX==0, SEE BELOW    */
  75.     int    dotmode;    /* video access method used by asm code */
  76.                 /*    1 == BIOS 10H, AH=12,13 (SLOW)    */
  77.                 /*    2 == access like EGA/VGA    */
  78.                 /*    3 == access like MCGA        */
  79.                 /*    4 == Tseng-like  SuperVGA*256    */
  80.                 /*    5 == P'dise-like SuperVGA*256   */
  81.                 /*    6 == Vega-like     SuperVGA*256    */
  82.                 /*    7 == "Tweaked" IBM-VGA ...*256  */
  83.                 /*    8 == "Tweaked" SuperVGA ...*256 */
  84.                 /*    9 == Targa Format        */
  85.                 /*    10 = Hercules            */
  86.                 /*    11 = "disk video" (no screen)   */
  87.                 /*    12 = 8514/A            */
  88.                 /*    13 = CGA 320x200x4, 640x200x2    */
  89.                 /*    14 = Tandy 1000         */
  90.                 /*    15 = TRIDENT  SuperVGA*256    */
  91.                 /*    16 = Chips&Tech SuperVGA*256    */
  92.     int    xdots;        /* number of dots across the screen    */
  93.     int    ydots;        /* number of dots down the screen    */
  94.     int    colors;     /* number of colors available        */
  95.     };
  96.  
  97.  
  98. #define INFO_ID     "Fractal"
  99. #define FRACTAL_INFO   struct fractal_info
  100.  
  101. /*
  102.  * Note: because non-MSDOS machines store structures differently, we have
  103.  * to do special processing of the fractal_info structure in loadfile.c.
  104.  * Make sure changes to the structure here get reflected there.
  105.  */
  106. #ifndef XFRACT
  107. #define FRACTAL_INFO_SIZE sizeof(FRACTAL_INFO)
  108. #else
  109. /* This value should be the MSDOS size, not the Unix size. */
  110. #define FRACTAL_INFO_SIZE 502
  111. #endif
  112.  
  113. struct fractal_info        /*  for saving data in GIF file     */
  114. {
  115.     char  info_id[8];        /* Unique identifier for info block */
  116.     short iterations;
  117.     short fractal_type;        /* 0=Mandelbrot 1=Julia 2= ... */
  118.     double xmin;
  119.     double xmax;
  120.     double ymin;
  121.     double ymax;
  122.     double creal;
  123.     double cimag;
  124.     short videomodeax;
  125.     short videomodebx;
  126.     short videomodecx;
  127.     short videomodedx;
  128.     short dotmode;
  129.     short xdots;
  130.     short ydots;
  131.     short colors;
  132.     short version;        /* used to be 'future[0]' */
  133.     float parm3;
  134.     float parm4;
  135.     float potential[3];
  136.     short rseed;
  137.     short rflag;
  138.     short biomorph;
  139.     short inside;
  140.     short logmap;
  141.     float invert[3];
  142.     short decomp[2];
  143.     short symmetry;
  144.             /* version 2 stuff */
  145.     short init3d[16];
  146.     short previewfactor;
  147.     short xtrans;
  148.     short ytrans;
  149.     short red_crop_left;
  150.     short red_crop_right;
  151.     short blue_crop_left;
  152.     short blue_crop_right;
  153.     short red_bright;
  154.     short blue_bright;
  155.     short xadjust;
  156.     short eyeseparation;
  157.     short glassestype;
  158.             /* version 3 stuff, release 13 */
  159.     short outside;
  160.             /* version 4 stuff, release 14 */
  161.     double x3rd;      /* 3rd corner */
  162.     double y3rd;
  163.     char stdcalcmode;      /* 1/2/g/b */
  164.     char useinitorbit;      /* init Mandelbrot orbit flag */
  165.     short calc_status;      /* resumable, finished, etc */
  166.     long tot_extend_len;  /* total length of extension blocks in .gif file */
  167.     short distest;
  168.     short floatflag;
  169.     short bailout;
  170.     long calctime;
  171.     BYTE trigndx[4];      /* which trig functions selected */
  172.     short finattract;
  173.     double initorbit[2];  /* init Mandelbrot orbit values */
  174.     short periodicity;      /* periodicity checking */
  175.             /* version 5 stuff, release 15 */
  176.     short pot16bit;      /* save 16 bit continuous potential info */
  177.     float faspectratio;   /* finalaspectratio, y/x */
  178.     short system;       /* 0 for dos, 1 for windows */
  179.     short release;      /* release number, with 2 decimals implied */
  180.     short flag3d;       /* stored only for now, for future use */
  181.     short transparent[2];
  182.     short ambient;
  183.     short haze;
  184.     short randomize;
  185.             /* version 6 stuff, release 15.x */
  186.     short rotate_lo;
  187.     short rotate_hi;
  188.     short distestwidth;
  189.             /* version 7 stuff, release 16 */
  190.     double dparm3;
  191.     double dparm4;
  192.             /* version 8 stuff, release 17 */
  193.     short fillcolor;
  194.             /* version 9 stuff, release 18 */
  195.     double mxmaxfp;
  196.     double mxminfp;
  197.     double mymaxfp;
  198.     double myminfp;
  199.     short zdots;
  200.     float originfp;
  201.     float depthfp;
  202.     float heightfp;
  203.     float widthfp;
  204.     float distfp;
  205.     float eyesfp;
  206.     short orbittype;
  207.     short juli3Dmode;
  208.     short maxfn;
  209.     short inversejulia;
  210.     double dparm5;
  211.     double dparm6;
  212.     double dparm7;
  213.     double dparm8;
  214.     double dparm9;
  215.     double dparm10;
  216.     short future[50];      /* for stuff we haven't thought of yet */
  217. };
  218.  
  219.  
  220.  
  221. #define MAXVIDEOMODES 300    /* maximum entries in fractint.cfg      */
  222. #ifndef XFRACT
  223. #define MAXVIDEOTABLE 40        /* size of the resident video modes table */
  224. #else
  225. #define MAXVIDEOTABLE 2         /* size of the resident video modes table */
  226. #endif
  227.  
  228. #define AUTOINVERT -123456.789
  229.  
  230. #define N_ATTR 8            /* max number of attractors    */
  231.  
  232. extern    long     l_at_rad;    /* finite attractor radius  */
  233. extern    double     f_at_rad;    /* finite attractor radius  */
  234.  
  235. #define NUMIFS      64     /* number of ifs functions in ifs array */
  236. #define IFSPARM    7     /* number of ifs parameters */
  237. #define IFS3DPARM 13     /* number of ifs 3D parameters */
  238.  
  239. #define ITEMNAMELEN 18     /* max length of names in .frm/.l/.ifs/.fc */
  240.  
  241. struct moreparams
  242. {
  243.    int      type;                        /* index in fractalname of the fractal */
  244.    char     *param[MAXPARAMS-4];    /* name of the parameters */
  245.    double   paramvalue[MAXPARAMS-4];     /* default parameter values */
  246. };
  247.  
  248. struct fractalspecificstuff
  249. {
  250.    char  *name;             /* name of the fractal */
  251.                     /* (leading "*" supresses name display) */ 
  252.    char  *param[4];            /* name of the parameters */
  253.    double paramvalue[4];         /* default parameter values */
  254.    int     helptext;            /* helpdefs.h HT_xxxx, -1 for none */
  255.    int     helpformula;            /* helpdefs.h HF_xxxx, -1 for none */
  256.    int     flags;             /* constraints, bits defined below */
  257.    float xmin;                /* default XMIN corner */
  258.    float xmax;                /* default XMAX corner */
  259.    float ymin;                /* default YMIN corner */
  260.    float ymax;                /* default YMAX corner */
  261.    int     isinteger;            /* 1 if integerfractal, 0 otherwise */
  262.    int     tojulia;            /* mandel-to-